/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.insurance.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author HeHui
* @date 2021-12-26
**/
@Entity
@Data
@Table(name="i_insured_user")
public class InsuredUser implements Serializable {

    private static final long serialVersionUID = 2839335601565120578L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "create_user_id")
    @ApiModelProperty(value = "录入人")
    private Long createUserId;

    @Column(name = "is_deleted")
    @ApiModelProperty(value = "是否删除")
    private Integer isDeleted;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建日期")
    private Timestamp createTime;

    @Column(name = "last_update_time")
    @ApiModelProperty(value = "最后操作时间")
    private Timestamp lastUpdateTime;

    @Column(name = "last_update_id",nullable = false)
    @ApiModelProperty(value = "操作人")
    private Long lastUpdateId;

    @Column(name = "owner_id")
    @ApiModelProperty(value = "所属人")
    private Long ownerId;

    @Column(name = "owner_company_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "所属公司ID")
    private Long ownerCompanyId;

    @Column(name = "user_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "骑手姓名")
    private String userName;

    @Column(name = "user_id_card",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "骑手身份证")
    private String userIdCard;

    @Column(name = "user_mobile")
    @ApiModelProperty(value = "被保人手机")
    private String userMobile;

    @Column(name = "policy_start_time")
    @ApiModelProperty(value = "保单生效时间")
    private Timestamp policyStartTime;

    @Column(name = "policy_ent_time")
    @ApiModelProperty(value = "保单失效时间")
    private Timestamp policyEntTime;

    @Column(name = "policy_status")
    @ApiModelProperty(value = "在保状态")
    private Integer policyStatus;

    public void copy(InsuredUser source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}